import { ResFileConst } from "../../../resource/ResFileConst";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ObjCreate } from "../../common/ObjCreate";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
//class BeaconBasePannel
    
    export  class BeaconBasePannel /* flash.display.Sprite */
    {
        constructor(arg1: string="", arg2: Boolean=true, arg3: string="", arg4: number=583, arg5: number=480)
        {
            
            this._samebg = arg2;
            this._imageResName = arg1;
            this._bgName = arg3;
            this._bgW = arg4;
            this._bgH = arg5;
            if (this._imageResName == "") 
            {
                this._imageResName = ResFileConst.dominionWarBeacon;
            }
            this.configUI();
            return;
        }

        protected configUI(): void
        {
            if (this._samebg) 
            {
                if (this._bgName == "") 
                {
                    this._bgName = ImagesConst.WindowCenterB;
                }
                this._bgImage = ObjCreate.createBg(0, 0, this._bgW, this._bgH, this, this._bgName);
            }
            if (this._imageResName != "") 
            {
                LoaderHelp.addResCallBack(this._imageResName, this.onImageLoaded);
            }
            return;
        }

        protected onImageLoaded(): void
        {
            this._isLoaded = true;
            return;
        }

        public update(arg1: Object): void
        {
            return;
        }

        public hide(): void
        {
            if (this.parent && !this._isHide) 
            {
                this._isHide = true;
                this.parent.removeChild(this);
            }
            return;
        }

        public get isHide(): Boolean
        {
            return this._isHide;
        }

        public show(arg1: Object /* flash.display.DisplayObjectContainer */): void
        {
            if (arg1) 
            {
                if (this._isHide) 
                {
                    this._isHide = false;
                    arg1.addChild(this);
                }
            }
            return;
        }

        public destroy(): void
        {
            this.hide();
            return;
        }

        protected /* var */_isLoaded: Boolean=false;

        protected /* var */_samebg: Boolean;

        protected /* var */_imageResName: string;

        protected /* var */_bgName: string;

        protected /* var */_bgImage: Object /* flash.display.Bitmap */;

        protected /* var */_bgW: number;

        protected /* var */_bgH: number;

        /* internal */ /* var */_isHide: Boolean=true;
    }
